import java.awt.EventQueue;
import java.awt.GridLayout;

import javax.swing.JFrame;
import javax.swing.JPanel;
import javax.swing.JTabbedPane;
import javax.swing.JTextField;
import javax.swing.JButton;
import java.awt.event.ActionListener;
import java.awt.event.ActionEvent;
import javax.swing.JComboBox;


public class Testar {

	private JFrame frame;
	private JTextField tf1;
	private JTextField tf2;
	private JComboBox comboBox1;

	/**
	 * Launch the application.
	 */
	public static void main(String[] args) {
		EventQueue.invokeLater(new Runnable() {
			public void run() {
				try {
					Testar window = new Testar();
					window.frame.setVisible(true);
				} catch (Exception e) {
					e.printStackTrace();
				}
			}
		});
	}

	/**
	 * Create the application.
	 */
	public Testar() {
		initialize();
	}

	/**
	 * Initialize the contents of the frame.
	 */
	private void initialize() {
		String hej = "dsa";
		frame = new JFrame();
		frame.setBounds(100, 100, 501, 349);
		frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
		frame.getContentPane().setLayout(new GridLayout(1, 0, 0, 0));
		
		JTabbedPane tabbedPane = new JTabbedPane(JTabbedPane.TOP);
		frame.getContentPane().add(tabbedPane);
		
		JPanel panel = new JPanel();
		tabbedPane.addTab("New tab", null, panel, null);
		panel.setLayout(null);
		
		tf1 = new JTextField();
		tf1.setBounds(10, 11, 197, 20);
		panel.add(tf1);
		tf1.setColumns(10);
		
		JButton btnSpara = new JButton("Spara");
		btnSpara.addActionListener(new ActionListener() {
			public void actionPerformed(ActionEvent arg0) {
				String text = tf1.getText();
				tf2.setText(text);
				comboBox1.addItem(text);
				
				
			}
		});
		btnSpara.setBounds(118, 46, 89, 23);
		panel.add(btnSpara);
		
		tf2 = new JTextField();
		tf2.setBounds(10, 93, 197, 20);
		panel.add(tf2);
		tf2.setColumns(10);
		
		comboBox1 = new JComboBox();
		comboBox1.setBounds(10, 150, 197, 20);
		panel.add(comboBox1);
		
		JPanel panel_1 = new JPanel();
		tabbedPane.addTab("New tab", null, panel_1, null);
		
		JPanel panel_2 = new JPanel();
		tabbedPane.addTab("New tab", null, panel_2, null);
	}
}
